package angryballsDecorateur.visitor;

import java.awt.Color;
import java.awt.Graphics;

import angryballsDecorateur.modele.bases.BilleDecorable;

public class BilleDessinateurVisitor implements BilleVisitor {

	private Graphics graphics;

	public BilleDessinateurVisitor(Graphics graphics) {
		this.graphics = graphics;
	}

	@Override
	public void visit(BilleDecorable bille) {
		int width, height;
		int xMin, yMin;

		xMin = (int) Math.round(bille.getPosition().x - bille.getRayon());
		yMin = (int) Math.round(bille.getPosition().y - bille.getRayon());

		width = height = 2 * (int) Math.round(bille.getRayon());

		graphics.setColor(bille.getColor());
		graphics.fillOval(xMin, yMin, width, height);
		graphics.setColor(Color.CYAN);
		graphics.drawOval(xMin, yMin, width, height);
	}
}
